package com.igeekhome.controller;

import com.igeekhome.pojo.DNetwork;
import com.igeekhome.service.INetworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author Romeo
 */
@Controller
@RequestMapping("/page/dest")
public class DestController {

    @Autowired
    private INetworkService networkService;

    @RequestMapping("")
    public String dest(){
        return "pages/data/destination/destination";
    }

    @RequestMapping("/add")
    public String add(Model model){
        List<DNetwork> networks = networkService.selectAll();
        System.out.println(networks);
        model.addAttribute("networks",networks);
        return "/pages/data/destination/destinationAdd";
    }
    @RequestMapping("/edit")
    public String edit(Model model){
        List<DNetwork> networks = networkService.selectAll();
        model.addAttribute("networks",networks);
        return "/pages/data/destination/destinationUpdate";
    }

}
